*Study 1: Replication File
*Latino Decisions survey (vignette study)
*By: Vanessa Cruz Nichols

use "Study1_AJPS.dta"


*Figure 1: "Study 1, Predictive Margins of Informal and Formal Political Participation by Treatment"
		*Informal Participation (Participation Scale outcome)
		reg participate3_std i.treatment_final immigopinion if outlier==0	
		*outreg2 using "table1_partic_immig.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Participate Scale") label replace excel seeout

		margins i.treatment_final, post
		coefplot, xline (0) xtitle(Treatments) ytitle(Pr(Informal participation)) vertical rescale(100) ytitle(Percent) recast(bar) barwidth(0.20) fcolor(gs10) scheme(s1color) ciopts(recast(rcap)) citop
		gr save participate3_immig_lf.gph, replace
	

		*Formal Participation (Postcard outcome)
		*logit postcard i.treatment_final immigopinion if outlier==0	
		**outreg2 using "table1_partic_immig.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Sent Postcard") label append excel seeout
		
			*Formal Participation (Postcard outcome)
		logit postcard i.treatment_final immigopinion if outlier==0, or
		*outreg2 using "table1_partic_immig.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Sent Postcard, OR") label append excel seeout
		margins i.treatment_final, post
		coefplot, xtitle(Treatments) ytitle(Pr(Formal participation - sent postcard)) vertical rescale(100) ytitle(Percent) recast(bar) barwidth(0.20) fcolor(gs10) scheme(s1color) ciopts(recast(rcap)) citop
		gr save postcard_immig_lf.gph, replace
		
		
		
*Table 2: "Study 1 Vignette Treatment Effects on Informal and Formal Forms of Political Participation, Party ID group"

*results broken out by partisanship
*Democrats
		*Participate_3std
		reg participate3_std i.treatment_final immigopinion if outlier==0 & partyid3==1	
		*outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Participate Scale, dummies, Dems") label append excel seeout
						

		
		*Postcard
		*logit postcard i.treatment_final immigopinion if outlier==0	& partyid3==1
		**outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Sent Postcard, Dems") label append excel seeout
	
		*Postcard (Odds-Ratios)
		logit postcard i.treatment_final immigopinion if outlier==0	& partyid3==1, or
		*outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Sent Postcard, Dems, OR") eform label append excel seeout
		

	
*Republicans
		*Participate_3std
		reg participate3_std i.treatment_final immigopinion if outlier==0 & partyid3==0
		*outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Participate Scale, dummies, Reps") label append excel seeout

		*Postcard
		*logit postcard i.treatment_final immigopinion if outlier==0	& partyid3==0
		**outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Sent Postcard, Reps") label append excel seeout
	
		*Postcard (Odds-Ratios)
		logit postcard i.treatment_final immigopinion if outlier==0	& partyid3==0, or
		*outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Sent Postcard, Reps, OR") eform label append excel seeout


*Independents
	*Participate_3std
		reg participate3_std i.treatment_final immigopinion if outlier==0 & partyid3==.5
		*outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Participate Scale, dummies, Indeps") label append excel seeout

		
		*Postcard, use this one with the control for immigopinino!.
		*logit postcard i.treatment_final immigopinion if outlier==0	& partyid3==.5
		**outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Sent Postcard, Indeps") label append excel seeout
			
		logit postcard i.treatment_final immigopinion if outlier==0	& partyid3==.5, or
		*outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Sent Postcard, Indeps, OR") eform label replace excel seeout

		
		
*Figure 2:"Study 1, Predictive Margins of Informal and Formal Forms of Participation by Treatment, among Republicans and Democrats"
		*For Figure 2b:
		*Formal Participation (Democrats)
		*Postcard (Odds-Ratios)
		logit postcard i.treatment_final immigopinion if outlier==0	& partyid3==1, or
		*Predictive margins for model above 
		*Figure 2b: 
		margins i.treatment_final, post
		coefplot, xtitle(Treatments) ytitle(Pr(Formal participation - sent postcard)) vertical rescale(100) ytitle(Percent) recast(bar) barwidth(0.20) fcolor(gs10) scheme(s1color) ciopts(recast(rcap)) citop
	gr save Postcard_dems.gph, replace
	
	
		*For Figure 2a: Republicans
		*Informal Participation (Republicans)
		*Participate_3std
		reg participate3_std i.treatment_final immigopinion if outlier==0 & partyid3==0
		**outreg2 using "table2_partic_immig_pid.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Participate Scale, dummies, Reps") label append excel seeout
		*Predictive margins for model above 
		*Figure 2a: 
		margins i.treatment_final, post
		coefplot, xtitle(Treatments) ytitle(Pr Informal participation) vertical rescale(100) ytitle(Percent) recast(bar) barwidth(0.20) fcolor(gs10) scheme(s1color) ciopts(recast(rcap)) citop
	gr save ParticD_reps.gph, replace
	
	
*Figure 3: " Study 1, Predictive Margins of Affective Manipulation Check"
		*Figure 3a:
		reg hopeful i.treatment_final immigopinion partyid7
		*outreg2 using "table3_affect_manip.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Hope") label replace seeout 
		margins i.treatment_final, post
		coefplot, xtitle(Treatments) ytitle(Pr(Hope)) vertical rescale(100) recast(bar) barwidth(0.20) fcolor(gs10) scheme(s1color) ciopts(recast(rcap)) citop
		gr save hope_predmargins.gph, replace
		
		
		*Figure 3b:
		reg afraid i.treatment_final immigopinion partyid7
		*outreg2 using "table3_affect_manip.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Fear") label append seeout 
		margins i.treatment_final, post
		coefplot, xtitle(Treatments) ytitle(Pr(Fear)) vertical rescale(100)recast(bar) barwidth(0.20) fcolor(gs10) scheme(s1color) ciopts(recast(rcap)) citop
		gr save fear_predmargins.gph, replace
				
	
	*Figure 4: Cognitive manipulation check
		reg cognthreat i.treatment_final immigopinion partyid7
		*outreg2 using "table3_affect_manip.doc", dec(3) paren(se) title("Effect of Tx")  ctitle("Cogn Perception (higher= more threat)") label append seeout 
		margins i.treatment_final, post
		coefplot, xtitle(Treatments) ytitle(Pr(Cognitive manipulation check)) vertical rescale(100) recast(bar) barwidth(0.20) fcolor(gs10) scheme(s1color) ciopts(recast(rcap)) citop
		gr save fear_predmargins.gph, replace
